import request from "@/utils/request";

// 活动列表获取接口
export function getActivityList(params) {
    return request({
        url: '/wlxz/activity/list',
        method: 'get',
        params: {
            // pageNum: params.pageNum || 1,
            // pageSize: params.pageSize || 10,
            // status: params.status || null,
            ...params
        }
    }).then(response => {
        // 确保响应数据结构完整
        if (!response || typeof response !== 'object') {
            console.error('Invalid response structure:', response);
            return {
                code: 500,
                msg: '服务器响应格式错误',
                rows: [],
                total: 0
            };
        }
        return {
            code: response.code || 200,
            msg: response.msg || 'success',
            rows: Array.isArray(response.rows) ? response.rows : [],
            total: response.total || 0
        };
    }).catch(error => {
        console.error('getActivityList error:', error);
        return {
            code: 500,
            msg: error.message || '网络请求失败',
            rows: [],
            total: 0
        };
    });
}

